// Created on Y 的iPad.

#include <stdio.h>

void swap(int *a, int *b);

int main() {
   printf("冒泡排序\n");
   int numbers[10] = {5,4,6,2,1,5,8,6,0,10};
   for (int i = 10 - 1; i > 0; i--){
      for (int j = i; j < 10; j++){
         if (numbers[j] < numbers[j - 1]){
            swap(&numbers[j],&numbers[j - 1]);
         }
      }
   }
   for (int i = 0; i < 10; i++){
      printf("%d ", numbers[i]);
   }
   return 0;
}

void swap(int *a, int *b){
   printf("%d %d\n", *a, *b);
   int temp = *a;
   *a = *b;
   *b = temp;
   printf("%d %d\n", *a, *b);
}